const totalCount = 3
const List = [
  {
    id: '@id',
    username: '李老汤拉面太原店',
    organization: '东盛餐饮',
    customerType: '经销商',
    salesman: '张三',
    principal: '李四',
    phoneNumber: '13124256698',
    status: '0',
    priceStrategy: '1',
  },
  {
    id: '@id',
    username: '里食真馄饨天津街店',
    organization: '妙禾食品',
    customerType: '加盟店',
    salesman: '王五',
    principal: '马六',
    phoneNumber: '13124256698',
    status: '1',
    priceStrategy: '2',
  },
]
module.exports = [
  {
    url: '/erp/customer',
    type: 'get',
    response(config) {
      const { title = '', pageNo = 1, pageSize = 20 } = config.body
      let mockList = List.filter((item) => {
        if (title && item.title.indexOf(title) < 0) return false
        return true
      })
      const pageList = mockList.filter(
        (item, index) =>
          index < pageSize * pageNo && index >= pageSize * (pageNo - 1)
      )
      return {
        code: 200,
        msg: 'success',
        totalCount,
        data: pageList,
      }
    },
  },
  {
    url: '/erp/customer',
    type: 'post',
    response() {
      return {
        code: 200,
        msg: '模拟保存成功',
      }
    },
  },
  {
    url: '/erp/customer',
    type: 'delete',
    response() {
      return {
        code: 200,
        msg: '模拟删除成功',
      }
    },
  },
]
